package goleetcode

func maximumNumberOfStringPairs(words []string) int {
	res := 0
	for i, j := 0, len(words) - 1; i < j; i, j = i + 1, j - 1 {
		if words[i] == reverseString(words[j]) {
			res++
		}
	}
	return res
}

func reverseString(s string) string {
	var res string
	for i := len(s) - 1; i >= 0; i-- {
		res += string(s[i])
	}
	return res
}